<?php
    include "admin_coupon.php";

$name=$_REQUEST['name'];
$coupon_type=$_REQUEST['type'];
$price_one=$_REQUEST['priceone'];
$price_two=$_REQUEST['pricetwo'];
$number=$_REQUEST['number'];
$startdate=$_REQUEST['startdate'];
$enddate=$_REQUEST['enddate'];
$rule=$_REQUEST['rule'];
// var_dump($id);

mysqli_select_db($conn,"shopping");

  $sql =  "insert into coupon(name,coupon_type,price_one,price_two,number,startdate,enddate,rule,`extend`) values
   ('$name','$coupon_type','$price_one','$price_two','$number','$startdate','$enddate','$rule','未发放')";

   $result=mysqli_query($conn,$sql);
     

    if (!$result){
        echo '优惠券添加失败！';
    }else{
        echo '优惠券添加成功！';
    }
    
    mysqli_close($conn);
?>
